﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using RentHouse.Service;
using RentHouse.DTO;
using RentHouse.IService;
using RentHouse.Service.Entities;

namespace RentHouse.Service
{
    public class CityService : ICityService
    {   
        /// <summary>
        /// 获取所有城市信息
        /// </summary>
        /// <returns></returns>
        public List<CityDTO> GetCity()
        {
            using (var db=new RentHouseContext())
            {
                var model = new BaseService<T_Cities>(db);
                var list = model.GetList(e => true).Select(e => new CityDTO()
                {
                    Id=e.Id,
                    Name=e.Name
                }).ToList();
                return list;
            }
            
        }
    }
}
